package chapter04

import scala.collection.immutable.Queue
import scala.collection.mutable

/**
 * @program lu-scala01
 * @description:  队列
 * @author: zhanglu
 * @create: 2022-04-09 17:12:00
 */
object Lu17_Queue {

  def main(args: Array[String]): Unit = {
    //可变队列
    val queue: mutable.Queue[String] = new mutable.Queue[String]()
    queue.enqueue("a", "b", "c")
    println(queue)
    println(queue.dequeue())
    println(queue)
    queue.enqueue("d")
    println(queue)

    println("===========")

    //不可变队列
    val queue2 = Queue("a", "b", "c")
    queue2.enqueue("d")
    println(queue2)
    val queue3 = queue2.enqueue("d")
    println(queue3)
  }

}
